﻿using DevExpress.Utils.Win;
using DevExpress.XtraEditors.Popup;
using DevExpress.XtraGrid.Editors;
using DevExpress.XtraLayout;
using DXApplicationTangche.UC.生产计划.生产批生产.service;
using DXApplicationTangche.UC.盘点.Service;
using DXApplicationTangche.UC.面料库存.盘点.service;
using DXApplicationTangche.UC.项目成果管理.service;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using 盘点Service = DXApplicationTangche.UC.盘点.Service.盘点Service;

namespace DXApplicationTangche.UC.盘点
{
    public partial class Form创建盘点计划 : DevExpress.XtraEditors.XtraForm
    {
        private StockInventoryPlanDTO stockInventoryPlanDTO;
        public Form创建盘点计划()
        {
            InitializeComponent();
        }
        private void simpleButton新建盘点计划_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(this.textBox负责人.Text))
            {
                MessageBox.Show("负责人无扫描信息");
                return;
            }
            String mnemonic = 项目成果Service.get判断扫描员工码是否正确(this.textBox负责人.Text.Trim());
            if (String.IsNullOrWhiteSpace(mnemonic))
            {
                this.textBox负责人.Clear();
                MessageBox.Show("扫描员工码错误，请重新扫描");
                return;
            }
            this.stockInventoryPlanDTO = 盘点Service
                                            .saveStockInventoryPlan(this.dateTimePicker开始时间.Value,
                                            this.dateTimePicker结束时间.Value,
                                            mnemonic,
                                            this.richTextBox备注.Text
                                            );
            if (String.IsNullOrWhiteSpace(stockInventoryPlanDTO.stockInventoryPlanCode))
            {
                MessageBox.Show("创建盘点计划失败");
                return;
            }
            MessageBox.Show("创建盘点计划完成");
            this.Close();
        }
    }
}
